<div class="panel panel-default panel-intro">
    {:build_heading()}

    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in" id="one">
                <div class="widget-body no-padding">
                    <div id="toolbar" class="toolbar">
                        <input id="matchId" type="hidden" value="{$matchId}">
                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
                        <a href="javascript:;" class="btn btn-success btn-edit" title="生成排行榜" onclick="generateRank();"><i class="fa fa-pencil"></i>生成排行榜</a>

                        
                    </div>
                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                           width="100%">
                    </table>
                </div>
            </div>

        </div>
    </div>
</div>

<script type="text/javascript">
    function generateRank(){
        var matchId = $('#matchId').val();
        $.post("{:url('match/ranks/ranks')}", {matchId:matchId}, function(data){
            if(data.code == 1){
                layer.msg(data.msg, {icon: 1});
                setTimeout(function(){
                    location.reload();
                }, 1000);
            }else{
                layer.msg(data.msg, {icon: 2});
            }
        });
    };
</script>
